import java.util.Scanner;
public class test {
    public static void main(String[] args) {
        System.out.print("输入一个三位的数将的到从1到该数的水仙花数\n");
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
             int a = i % 10;
             int b = i % 100 / 10;
             int c = i / 100;
            if (i == a * a * a + b * b * b + c * c * c&&i!=1) {
                System.out.println(i);
            }
        }
    }
}
